package com.adobe.training.core.impl;


import java.util.Dictionary;


import javax.jcr.RepositoryException;
import javax.jcr.Session;


import org.apache.felix.scr.annotations.Component; 
import org.apache.felix.scr.annotations.Property; 
import org.apache.felix.scr.annotations.Reference; 
import org.apache.felix.scr.annotations.Service; 
import org.apache.sling.commons.osgi.OsgiUtil; 
import org.apache.sling.jcr.api.SlingRepository; 
import org.osgi.service.component.ComponentContext; 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


@Component(immediate = true, metatype = true, label = "Test Configuration")
public class TestConfiguration{

    private static final Logger LOGGER = LoggerFactory.getLogger(TestConfiguration.class);
    
    @Property(label = "IP 1", description = "WAS IP 1", value = "192.168.0.1")
    public static final String IP1 = "ip1";
    private String ipPath1;
    
    @Property(label = "IP 2", description = "WAS IP 2", value = "192.168.0.2")
    public static final String IP2 = "ip2";
    private String ipPath2;
    
    
    protected void activate(ComponentContext componentContext){
        configure(componentContext.getProperties());
    }
    
    
    protected void configure(Dictionary<?, ?> properties) {
        this.ipPath1 = properties.get(IP1).toString();
        LOGGER.info("configure: ip1=’{}’", this.ipPath1);
        
        this.ipPath2 = properties.get(IP2).toString();
        LOGGER.info("configure: ip2=’{}’", this.ipPath2);
    }
}
